<?php
/**
 * @version		0.2.0 joomla zmluvy $
 * @package		com_zjmluvy
 * @copyright	Copyright © 2011 - All rights reserved.
 * @license		GNU/GPL
 * @author    AdrianKo		
 * @website   http://code.google.com/p/joomla-zmluvy
 *
 *
 *1.3.2012
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.view' );
jimport( 'joomla.html.parameter' );


class jzmluvyViewupravapartner extends Jview
{
	
  function display($tpl = null){
		global $mainframe, $option;
		
		$db 		=& JFactory::getDBO();
		$id		= JRequest::getVar( 'id', '', '', 'string' );
		
		//get data from model
		$model		= & $this->getModel();
		$item    	= & $this->get( 'Data');
    $params	= &JComponentHelper::getParams('com_jzmluvy');
    $nastavenie = & jzmluvyHelper::nastavenie();

		$lists['published'] = JHTML::_('select.booleanlist','published','class="inputbox"',$item->published);
		$lists['favorit'] = JHTML::_('select.booleanlist','reserverd','class="inputbox"',$item->reserverd);    
         
    $lists['typ'] = JHTML::_('select.booleanlist','typ','',$item->typ);
        
    $lists['logo'] = JHTML::_('list.images', 'logo', $item->logo, null, '/media/com_jzmluvy/logo/' );
    
        // obchodny register vyber
    $orr_sud[] = JHTML::_('select.option',  0, ' - '.JText::_( 'PA_OR_SUD_VYBER' ).' -');
    $orr_sud[] = JHTML::_('select.option',  3, 'Okresný Súd Banská Bystrica (S)');
    $orr_sud[] = JHTML::_('select.option',  2, 'Okresný Súd Bratislava I (B)');
    $orr_sud[] = JHTML::_('select.option',  4, 'Okresný Súd Košice I (V)');
    $orr_sud[] = JHTML::_('select.option',  9, 'Okresný Súd Nitra (N)');
    $orr_sud[] = JHTML::_('select.option',  8, 'Okresný Súd Prešov (P)');
    $orr_sud[] = JHTML::_('select.option',  6, 'Okresný Súd Trenčín (R)');
    $orr_sud[] = JHTML::_('select.option',  7, 'Okresný Súd Trnava (T)');
    $orr_sud[] = JHTML::_('select.option',  5, 'Okresný Súd Žilina (L)');
    $lists['orr_sud'] 	= JHTML::_('select.genericlist',   $orr_sud, 'or_sud', 'class="inputbox" size="1" title="'.JText::_( 'PA_OR_SUD_INFO' ).'"', 'value', 'text', $item->or_sud );
     
    $orr_odd[] = JHTML::_('select.option',  0, ' - '.JText::_( 'PA_OR_ODD_VYBER' ).' -');
    $orr_odd[] = JHTML::_('select.option',  1, 'Pš');
    $orr_odd[] = JHTML::_('select.option',  2, 'Sa');
    $orr_odd[] = JHTML::_('select.option',  3, 'Sro');
    $orr_odd[] = JHTML::_('select.option',  4, 'Sr');
    $orr_odd[] = JHTML::_('select.option',  5, 'Firma');
    $orr_odd[] = JHTML::_('select.option',  6, 'Dr');
    $orr_odd[] = JHTML::_('select.option',  7, 'Po');
    $orr_odd[] = JHTML::_('select.option',  8, 'Pšn');
    $lists['orr_odd'] 	= JHTML::_('select.genericlist',   $orr_odd, 'or_odd', 'class="inputbox" size="1" title="'.JText::_( 'PA_OR_ODD_INFO' ).'"', 'value', 'text', $item->or_odd );
    
    $hodnost[] = JHTML::_('select.option',  1, '1');
    $hodnost[] = JHTML::_('select.option',  2, '2');
    $lists['hodnost'] 	= JHTML::_('select.genericlist',   $hodnost, 'ic_dph', 'class="inputbox" size="1" title="'.JText::_( 'PA_HODNOST_INFO' ).'"', 'value', 'text', $item->ic_dph );
    
    $this->assignRef('item', $item);
    $this->assignRef('lists', $lists);
    $this->assignRef('params', $params);
    $this->assignRef('nastavenie', $nastavenie);

		parent::display($tpl);

	}
   
  //*** zistenie poctu partnerov TYP
  function pocet($typ) {
    $db				=& JFactory::getDBO();
		
		$query = 'SELECT COUNT(id)'
		  . ' FROM #__jzmluvy_partner'
		  . ' WHERE typ = '.$typ
		;

		$db->setQuery( $query );
		$total_akt = $db->loadResult();
		    	
		return $total_akt ;  
  }
  
}
?>